<?php echo Modules::run('content/header_content') ?>

<!--list grid view-->
<!--<script type="text/javascript">
	function imgLoaded(img){	
		$(img).parent().addClass('loaded');
	};
	$(function(){
		$('#itemSearch').mixitup({
			layoutMode: 'list', // Start in list mode (display: block) by default
			listClass: 'list', // Container class for when in list mode
			gridClass: 'grid', // Container class for when in grid mode
			transitionSpeed: 0,
			effects: ['fade','blur'], // List of effects 
			listEffects: ['fade','rotateX'] // List of effects ONLY for list mode
		});
		$('#ToList').on('click',function(){
			$('.button-view').removeClass('active');
			$(this).addClass('active');
			$('#itemSearch').mixitup('toList');
		});
		$('#ToGrid').on('click',function(){
			$('.button-view').removeClass('active');
			$(this).addClass('active');
			$('#itemSearch').mixitup('toGrid');
		});
		/*pagination*/
		$("div.holder").jPages({
		  containerID  : "itemSearch",
		  perPage      : 12,
		  startPage    : 1,
		  startRange   : 1,
		  midRange     : 5,
		  endRange     : 1
		});
		
	});
</script> -->
 
  <div class="container main">
    <div>
      
      
      <div class="15">
        <div class="row">
          <div class="span15 content">
            <h2>
              <span class="red">
				<?php  
					echo $count;
				?>
                
              </span>
              results found for 
              <span class="red">
                <?php  
					echo $match; 
				?>
              </span>
            </h2>
          </div>
        </div>
        <div class="row">
          
          <div class="span10 content">
            <div class="row box-product-row box">
                <nav class="controls just">
				<div class="group" id="Sorts">
					<a href="<?php echo site_url('search/lists/'); ?>"><div class="button-view" id="ToList"><i></i></div></a>
					<a href="<?php echo site_url('search/grid/'); ?>"><div class="button-view active" id="ToGrid"><i></i></div></a>
                  <p class="group">
                    Sort by Price
                  </p>
                  	<a href="<?php echo site_url('search/grid_high/'); ?>">
                    <div class="button-price sort " data-sort="data-price" data-order="asc">
                      <span><div class="arr_asc ib"></div></span>
                    </div></a>
                    <a href="<?php echo site_url('search/grid_low/'); ?>">
                    <div class="button-price sort active" data-sort="data-price" data-order="desc">
                      <span><div class="arr_desc ib"></div></span>
                    </div></a>
               </div>
              </nav>
              <h2>
                Search Result
              </h2>
              <div class="just grid" id="itemSearch">
              
              <?php $currency = $this->currency->getCurrency();?>
              <?php if(count($search) > 0){ ?>
              <?php foreach ($search as $key => $val) { ?>

				<?php 
                $product_id = $val->product_id;
                //$price = number_format($val->price,2,',','.');
				$price = $this->currency->format($val->price, $currency); 
        
                $product_name_length = strlen($val->product_name);
                $product_name_limit = $val->product_name;
        
                	if ($product_name_length > 18){
                    	$product_name_limit = substr($val->product_name, 0, 18) . '..';
                	}
                
                ?>
              
                <div class="box-product box-product-list mix" style="display:inline-block; opacity:1;" data-price ="<?php echo $val->price ?>" data-store="Lorem lipsum dolor sit." data-product-id="<?php echo $product_id; ?>" data-product-title="<?php echo $val->product_name; ?>">
                  <div class="row">
                    <div class="span3 img_wrapper">
                      <a href="<?php echo site_url('product/detail/'.$val->product_seo_name); ?>" title="<?php echo $val->product_name ?> Rp <?php echo $price ?>">
                      <?php if($val->image_file == NULL) {?>
                        <img style="padding:10px;" src="<?php echo base_url('assets/img/no-image-100x100.png') ?>" title="No Image"/>
                      <?php }else{ ?>
                        <img src="<?php echo base_url('data/thumb/'.$val->image_file) ?>" width="120" height="90" title="<?php echo $val->product_name ?> Rp <?php echo $price ?>" alt="<?php echo $val->product_name ?> Rp <?php echo $price ?>">
                      <?php } ?>
                      </a>
                    </div>
                    <div class="span5 meta product">
                      <div class="titles">
                        <a href="<?php echo site_url('product/detail/'.$val->product_seo_name); ?>" title="<?php echo $val->product_name ?> Rp <?php echo $price ?>" alt="<?php echo $val->product_name ?> Rp <?php echo $price ?>">
                         <?php echo $product_name_limit ?>
                        </a>
                      </div>
                      <div class="desc">
                        <?php echo $val->description; ?>
                      </div>
                       <?php $store = $this->search_model->get_store(); ?>
                      <div class="shop">
                        <?php foreach ($store as $keys => $vals) { ?>
                        <?php if($vals->user_id == $val->user_id){ ?>
                          <a href="<?php echo base_url('store/lists/'.$vals->toko_id) ?>" title="<?php echo $vals->nama_toko ?>">
                            <?php echo $vals->nama_toko ?>
                          </a>
                        <?php } ?>
                        <?php } ?>
                      </div>
                    </div>
                    <div class="span2 meta price-item">
                        Rp <?php echo $price; ?>
                    </div>
                    <div class="span2 meta cart">
                      <a class="add_cart" data-product="<?php echo $product_id; ?>">Add to Cart</a>
                    </div>
                  </div>
                </div>
				<?php } ?>
                <?php }else{ 
					
				}?>
              </div>
			  
              <div class="clearfix">
            </div>
             <div class="storefront-bottom">
                <div id="paging_area" class="">
                    <center>
                      <?php echo $pagination; ?>
                    </center>
                </div>
                <!--<div class="storefront-show">
                </div>-->
              </div>
          </div>
          
        </div>
      </div>
    </div>
  </div>
</div>



<?php echo Modules::run('content/footer_content') ?>